﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfLussen
{
    /// <summary>
    /// Interaction logic for WpfTafels.xaml
    /// </summary>
    public partial class WpfTafels : Window
    {
        public WpfTafels()
        {
            InitializeComponent();
        }

        private void btnTafel5_Click(object sender, RoutedEventArgs e)
        {
            lbTafels.Items.Clear();
            ToonTafel(5);
        }

        private void ToonTafel(int tafel)
        {
            for (int i = 1; i <= 10; i++)
            {
                lbTafels.Items.Add(i +" x " +tafel +" = " +(i * tafel));
            }
        }

        private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            lbTafels.Items.Clear();
            int tafel = Convert.ToInt32(((ComboBoxItem)comboBox1.SelectedItem).Content);
            ToonTafel(tafel);
        }

        private void btnTafels_1_10_Click(object sender, RoutedEventArgs e)
        {
            lbTafels.Items.Clear();
            for (int i = 1; i <= 10; i++)
            {
                ToonTafel(i);
                lbTafels.Items.Add("");
            }

        }
    }
}
